<%--
  Created by IntelliJ IDEA.
  User: WZL
  Date: 2020/5/20
  Time: 15:32
  To change this template use File | Settings | File Templates.
--%>
<%@ page import="top.fyxxxx.dbdesign.data.Course" %>
<%@ page import="java.util.List" %>
<%@ page import="top.fyxxxx.dbdesign.util.CourseManager" %>
<%@ page import="java.util.Set" %>
<%@ page import="top.fyxxxx.dbdesign.data.Account" %>
<%@ page import="top.fyxxxx.dbdesign.dao.DBoperate" %>
<%@ page import="top.fyxxxx.dbdesign.util.Manager" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page isELIgnored="false" %>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>选择班级</title>
    <link rel="stylesheet" type="text/css" href="login.css">
    <link rel="stylesheet" type="text/css" href="boxAndButton.css">
</head>
<body >
<%
    DBoperate dBoperate=DBoperate.getInstance();
    CourseManager courseManager= Manager.courseManager();
%>

<div id="content">
    <div style="text-align: center">
        <p class="title">选择要发布签到任务的课程</p>
    </div>
    <%
        if(session.getAttribute("uid")==null)request.getRequestDispatcher("/index.jsp").forward(request,response);
        long uid=(Long)session.getAttribute("uid");
        List<Course> courseList= courseManager.getPowerCourse(uid);
        for(Course course:courseList){
            long cid=course.getCid();
    %>
    <div style="width: 100%">
        <p class="title"><%=course.getName()%></p>
        <div class="joinBox" >
            <button
                    onclick="location='assignments.jsp?cid=<%=cid%>&ClassName=<%=course.getName()%>'"
            >发布任务</button>
        </div>
        <%
            String teacherName="";
            Set<Long> set=course.getPowerUid();

        %>
        <p class="mainBody">任课老师：<%
            for (Long powerUid:set){
                Account account= DBoperate.getInstance().getAccountByUid(powerUid);
                out.print(account.getName()+"  ");
            }
        %><br>
            班级人数：<%=course.getMemberUid().size()%></p>
        <hr>
    </div>
    <%
        }
    %>
</div>

</body>
</html>

